package net.metashare.grah.operation

import net.metashare.grah.Edge
import net.metashare.grah.Graph
import net.metashare.grah.ResultGraph
import net.metashare.grah.pogo.SimplePogoGraph
import net.metashare.grah.logic.Predicate
import net.metashare.grah.meta.MetaContext

/**
 * Grah is a notion produced by metashare.net
 * User: dsherema
 * Date: May 1, 2010
 * Time: 5:53:18 PM
 *
 */
class Filter extends Operation {

  def Predicate predicate

  def Filter(predicate) {
    this.predicate = predicate;
  }



  def ResultGraph apply(Graph graph) {
    Graph out = new SimplePogoGraph();

    if (predicate instanceof Predicate) {
      out.add(graph.edges(predicate))
    }
    else {
      out.add(graph.nodes())
    }

    return new ResultGraph(out, this, graph)
  }

  def List nodes(Predicate p) {
    return null;  //To change body of implemented methods use File | Settings | File Templates.
  }

  def List<Edge> edges(Predicate p) {
    return null;  //To change body of implemented methods use File | Settings | File Templates.
  }

  def MetaContext context() {
    return null;  //To change body of implemented methods use File | Settings | File Templates.
  }
}
